<nav class="navbar navbar-expand-lg navbar-dark bg-dark" style="margin-bottom: 15px">
    <div class="container">
        <a class="navbar-brand" href="{{route('home')}}">留言板</a>
        <ul class="navbar-nav justify-content-end">
            @if(\Illuminate\Support\Facades\Auth::check())
                <div class="nav-item d-none d-md-block">
                    <img src="{{ \Illuminate\Support\Facades\Auth::user()->getAvatar() }}"
                         alt="{{ \Illuminate\Support\Facades\Auth::user()->name }}"
                         width="40"
                         class="rounded-circle border border-2 border-light shadow-sm user-avatar"/>
                </div>
                <div class="container-fluid">
                    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavDarkDropdown" aria-controls="navbarNavDarkDropdown" aria-expanded="false" aria-label="Toggle navigation">
                        <span class="navbar-toggler-icon"></span>
                    </button>
                    <div class="collapse navbar-collapse" id="navbarNavDarkDropdown">
                        <ul class="navbar-nav">
                            <li class="nav-item dropdown">
                                <button class="btn btn-dark dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
                                   {{\Illuminate\Support\Facades\Auth::user()->name}}
                                </button>
                                <ul class="dropdown-menu dropdown-menu-dark">
                                    <li><a class="dropdown-item" href="{{route('users.show',\Illuminate\Support\Facades\Auth::user()) }}">个人中心</a></li>
                                    <li><a class="dropdown-item" href="{{route('users.edit',\Illuminate\Support\Facades\Auth::id())}}">编辑资料</a></li>
                                    <li><a class="dropdown-item" href="{{route('users.index')}}">会员列表</a></li>
                                    <li>
                                        <a class="dropdown-item" id="logout" href="#">
                                            <form action="{{route('logout')}}" method="POST">
                                                @csrf
                                                {{method_field("DELETE")}}
                                                <button type="submit">退出登录</button>
                                            </form>
                                        </a>
                                    </li>
                                </ul>
                            </li>
                        </ul>
                    </div>
                </div>
            @else
            <li class="nav-item"><a class="nav-link" href="{{route('login')}}">登录</a></li>
            @endif
        </ul>
    </div>
</nav>
